var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        });
Object.defineProperty(o, "__esModule", {value: !0});
var n = t("BaseSdkMode"),
    r = t("WkSdkManager"),
    s = t("MiniSdkManager"),
    c = t("GameCof"),
    p = new ((function (t) {
        i(e, t);
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            e.curSdk = null;
            e.payCallCb = null;
            e.lastCostTime = 0;
            e.isPaySuccess = !1;
            e.callSuccessData = {isCall: !1, callBool: !1};
            return e;
        }
        e.prototype.init = function () {
            var t = this;
            if (1 == c.default.sdkType) {
                this.curSdk = new r.default();
                this.curSdk.init(
                    function () {
                        console.log("可以进入登录了");
                        c.default.setLoginData();
                        GameBaseManager.sendFirstEnterGame();
                    },
                    function () {
                        t.setPayIsSuccess(!0);
                    },
                    function () {
                        t.setPayIsSuccess(!1);
                    }
                );
            } else {
                if (2 != c.default.sdkType) return !1;
                this.curSdk = new s.default();
                this.curSdk.init(function () {});
            }
        };
        e.prototype.login = function () {
            this.curSdk.login();
        };
        e.prototype.haveCallBack = function () {
            if (this.payCallCb) return !1;
            var t = Date.now() - this.lastCostTime > 1e3;
            console.log("是否可以进行下一次点击", t);
            this.lastCostTime = Date.now();
            return t;
        };
        e.prototype.addPayData = function (t, e, o, a, i) {
            var n = this;
            console.log("PayData -----------------pay id  " + t, e);
            if (!this.payCallCb) {
                this.payCallCb = {cb: a, id: t};
                this.startAsynPay(
                    t,
                    e,
                    o,
                    function () {
                        n.setPayIsSuccess(!1);
                    },
                    i
                );
            }
        };
        e.prototype.startAsynPay = function (t, e, o, a, i) {
            this.curSdk.startAsynPay(t, e, o, a, i);
        };
        e.prototype.udpateCall = function () {
            if (this.callSuccessData && this.callSuccessData.isCall) {
                this.callSuccessData.isCall = !1;
                if (this.payCallCb) {
                    if (this.payCallCb.cb)
                        try {
                            this.payCallCb.cb(this.callSuccessData.callBool);
                        } catch (t) {
                            console.log("支付回调异常", t.message);
                        }
                    this.payCallCb = null;
                }
            }
        };
        e.prototype.setPayIsSuccess = function (t) {
            console.log("支付", "发放奖励");
            this.callSuccessData.isCall = !0;
            this.callSuccessData.callBool = t;
        };
        e.prototype.reissueReward = function (t, e) {
            this.curSdk.reissueReward(t, e);
        };
        return e;
    })(n.default))();
window.SdkManager = p;
o.default = p;
